gnttab: don't use possibly unbounded tail calls
authorJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2017 12:39:18 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 17 Aug 2017 12:39:18 +0000 (14:39 +0200)
commit999d2ccb7f73408aa22656e1ba2f98b077eaa1c2
treeb6849375b2a5c9fbdbb35c6c11d820e5a0ab2890
parentf859e4a3b9088a76fe733fd0312b0922f90b85e1
gnttab: don't use possibly unbounded tail calls

There is no guarantee that the compiler would actually translate them
to branches instead of calls, so only ones with a known recursion limit
are okay:
- __release_grant_for_copy() can call itself only once, as
  __acquire_grant_for_copy() won't permit use of multi-level transitive
  grants,
- __acquire_grant_for_copy() is fine to call itself with the last
  argument false, as that prevents further recursion,
- __acquire_grant_for_copy() must not call itself to recover from an
  observed change to the active entry's pin count

This is part of XSA-226.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/grant_table.c